#!/usr/bin/env python
# -*- coding: utf-8 
import re

# common variables

rawstr =          r"""\(.*?\)"""
#embedded_rawstr = r"""\(.*?\)"""
matchstr = """(de|en|el)/subsite/(dir1|dir2)"""

 
print re.findall(rawstr,matchstr)
def refindregor(regexpr):					#find all (. | .|) in a string
    rawstr =          r"""\(.*?\)"""
    return re.findall(rawstr,regexpr) 
def permutelists(*iterables):
    if iterables:
        for head in iterables[0]:
            for remainder in permutelists(*iterables[1:]):
                yield [head] + remainder
    else:
        yield []
       
#def permutlsts(*iterables):
#    rt=[]
#    if iterables:
#       for head in iterables[0]:
#	   
#           for remainder in permutelists(*iterables[1:]):
#	       rt.apend(head
     
 

def permutelistsfast(lists):				#list of all posible urls 
    out =  '[' + ','.join(["v%s" % i for i in range(len(lists))]) + ']'
    comp = ''.join([ " for v%d in lists[%d]" % (i, i) for i in range(len(lists))])
    return eval('[ ' + out + comp + ' ]')

def permutelistsfaststr(lst):				#str of all posible urls
    rt=[]
    for l in lst:
        rt.append ='/'.join(l)
    return rt 